//
//
/*
 *    SSJumpMapNavRect.m
 *  MESLib
 * 
 * Copyright 2003-2009 Starline Software Ltd
 * 
 * This file is part of MESLib.
 * 
 * MESLib is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * MESLib is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with MESLib. If not, see <http://www.gnu.org/licenses/>.
 */
//  Created by Tobias Haughton on Thu Apr 17 2003.
//

#import "SSJumpMapNavRect.h"


@implementation SSJumpMapNavRect

- (id)initWithFrame:(NSRect)frame
{
   if (self = [super init]) {
      [self setFrameOrigin:frame.origin];
      [self setFrameSize:frame.size];
   }
   return self;
}

- (void)draw
{
   [NSBezierPath strokeRect:[self frame]];
}

- (NSRect)frame
{
   return NSMakeRect([self frameOrigin].x, [self frameOrigin].y, [self frameSize].width, [self frameSize].height);
}

- (NSSize)frameSize
{
   return frameSize;   
}

- (NSPoint)frameOrigin
{
   return frameOrigin;
}

- (void)setFrameSize:(NSSize)size
{
   frameSize = size;   
}

- (void)setFrameOrigin:(NSPoint)point
{
   frameOrigin = point;
}

- (BOOL)containsPoint:(NSPoint)point
{
   NSPoint origin = [self frameOrigin];
   NSRect frame = [self frame];

   if(point.x > origin.x) {
      if(point.x < (origin.x + NSWidth(frame))) { //it is within our x range
         if(point.y > origin.y) {
            if(point.y < (origin.y + NSHeight(frame))) {
               //we contain this point
               return YES;
            }
         }
      }
   }
   return NO;
}

@end
